import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RegionalInfoVO, RegionalInfoForm, RegionalInfoQuery } from '@/api/tearoom/regionalInfo/types';

/**
 * 查询区域信息列表
 * @param query
 * @returns {*}
 */

export const listRegionalInfo = (query?: RegionalInfoQuery): AxiosPromise<RegionalInfoVO[]> => {
  return request({
    url: '/tearoom/regionalInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询区域信息详细
 * @param id
 */
export const getRegionalInfo = (id: string | number): AxiosPromise<RegionalInfoVO> => {
  return request({
    url: '/tearoom/regionalInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增区域信息
 * @param data
 */
export const addRegionalInfo = (data: RegionalInfoForm) => {
  return request({
    url: '/tearoom/regionalInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改区域信息
 * @param data
 */
export const updateRegionalInfo = (data: RegionalInfoForm) => {
  return request({
    url: '/tearoom/regionalInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除区域信息
 * @param id
 */
export const delRegionalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/regionalInfo/' + id,
    method: 'delete'
  });
};

/**
 * 恢复区域信息
 * @param id
 */
export const recoverRegionalInfo= (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/regionalInfo/recover/' + id,
    method: 'put'
  });
};

/**
 * 永久删除区域信息
 * @param id
 */
export const foreverDeleteRegionalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/regionalInfo/foreverDelete/' + id,
    method: 'delete'
  });
};
